/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.backlog.domain.db;

import java.io.Serializable;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

/**
 *
 * @author Gleibson Oliveira
 */
@Entity
public class Sprint implements Serializable{

    @Id @GeneratedValue(strategy=GenerationType.AUTO)
    private int id;
    private String name;
    private double totalHours;

    @ManyToOne
    @JoinColumn(name="PROJECT_ID", nullable=false)
    private Project project;

    @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY)
    @JoinColumn(name="SPRINT_ID", nullable=false)
    private List<Task> tasks;

    //TODO incluir data de criação
    //TODO incluir id do usuário 

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getTotalHours() {
        return totalHours;
    }

    public void setTotalHours(double totalHours) {
        this.totalHours = totalHours;
    }

    public Project getProject() {
        return project;
    }

    public void setProject(Project project) {
        this.project = project;
    }

    public List<Task> getTasks() {
        return tasks;
    }

    public void setTasks(List<Task> tasks) {
        this.tasks = tasks;
    }

    

}
